<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
</head>
<body>
    <button class="btn">打印</button>
    <script src="./jquery-3.5.1.min.js"></script>
    <script language="javascript" src="./LodopFuncs2.js"></script>
    <script language="javascript" type="text/javascript">
    $(".btn").click(() => {
        console.log(123)
            CreatePrintPage();
            console.log(CreatePrintPage)

    })
        //window.addEventListener("load", function () {
        //    CreatePrintPage();
        //});
        //window.onload = function (pds) {
        //    try {
        //        var msg = "";
        //        var flag = true;
        //        var urlParameters = location.search;
        //        //如果该求青中有请求的参数，则获取请求的参数，否则打印提示此请求没有请求的参数
        //        if (urlParameters.indexOf('?') != -1) {
        //            //获取请求参数的字符串
        //            var parameters = decodeURI(urlParameters.substr(1));
        //            var obj = JSON.parse(parameters);
        //            for (var i = 0; i < obj.length; i++) {
        //                var stationName = obj[i].StationName;
        //                var BusNo = obj[i].BusNo;
        //                bound.showMsgForJs(msg + i, flag);
        //                CreatePrintPage(stationName, BusNo);
        //            }
        //            msg = "打印成功";
        //        }
        //        else {
        //            msg = "没有取到打印数据";
        //        }
        //    }
        //    catch (exception) {
        //        msg = exception.message;
        //        flag = false;
        //    }
        //    finally {
        //        //此处第一个字母必须是小写！小写！小写！
        //        // bound.showMsgForJs(msg, flag);
        //        bound.printResult("741852963", msg + i, flag);
        //    }
        //}
        ///程序暂停执行
        function sleep(milliSeconds) {
            var start = (new Date()).getTime();
            while ((new Date()).getTime() - start < milliSeconds) {
                continue;
            }
        }
        window.onload = function () {
            console.log(CreatePrintPage)
        }
        function CreatePrintPage() {
            var LODOP; //声明为全局变量
            // sleep(1000);
            LODOP = getLodop();
            LODOP.PRINT_INITA("-0.397cm", "-0.794cm", "21.167cm", "15.875cm", "车票模板");
            LODOP.SET_PRINT_MODE("PRINT_NOCOLLATE", 1);
            LODOP.ADD_PRINT_SETUP_BKIMG("D:\\soft\\Chrome\\图片\\微信图片_20210114145135.jpg");
            LODOP.SET_PRINT_PAGESIZE(1, "13cm", "6.35cm", "");
            LODOP.SET_SHOW_MODE("BKIMG_LEFT", 0);
            LODOP.SET_SHOW_MODE("BKIMG_TOP", 0);
            LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "129.91mm");
            LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "63.5mm");
            LODOP.ADD_PRINT_TEXT("2.778cm", "1.005cm", "2.646cm", "0.529cm", "stationName");
            LODOP.ADD_PRINT_TEXT("3.81cm", "0.873cm", "0.9cm", "0.661cm", "BusNo");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT("3.81cm", "1.746cm", "1.826cm", "0.661cm", "小雍庄校小");
            LODOP.ADD_PRINT_TEXT("3.81cm", "3.572cm", "1.296cm", "0.661cm", "ZM010");
            LODOP.ADD_PRINT_TEXT("4.974cm", "0.926cm", "1.032cm", "0.661cm", "01.16");
            LODOP.ADD_PRINT_TEXT("4.974cm", "1.984cm", "1.429cm", "0.661cm", "100.00");
            LODOP.ADD_PRINT_TEXT("4.974cm", "3.36cm", "1.561cm", "0.661cm", "自311");
            LODOP.SET_PRINT_STYLEA(0, "Alignment", 2);
            LODOP.ADD_PRINT_TEXT("1.191cm", "5.345cm", "2.646cm", "0.529cm", "检票口：20");
            LODOP.ADD_PRINT_TEXT("1.667cm", "5.345cm", "2.646cm", "0.529cm", "发车位：10-99");
            LODOP.ADD_PRINT_TEXT("2.196cm", "5.345cm", "2.646cm", "0.529cm", "郑州东站");
            LODOP.ADD_PRINT_TEXT("2.699cm", "5.318cm", "4.128cm", "0.661cm", "4113221993****0626杜丽蕾");
            LODOP.ADD_PRINT_TEXT("3.149cm", "5.318cm", "2.646cm", "0.529cm", "打印时间：10:35");
            LODOP.ADD_PRINT_TEXT("3.625cm", "5.371cm", "2.646cm", "0.529cm", "小雍庄");
            LODOP.ADD_PRINT_TEXT("4.154cm", "5.371cm", "2.646cm", "0.529cm", "中牟");
            LODOP.ADD_PRINT_TEXT("5.001cm", "5.371cm", "2.646cm", "0.529cm", "2021.01.16");
            LODOP.ADD_PRINT_TEXT("3.969cm", "8.149cm", "1.693cm", "0.529cm", "100.00");
            LODOP.ADD_PRINT_TEXT("3.784cm", "10.557cm", "0.873cm", "0.529cm", "6731");
            LODOP.ADD_PRINT_TEXT("3.784cm", "11.404cm", "0.661cm", "0.529cm", "99");
            LODOP.ADD_PRINT_TEXT("4.974cm", "8.043cm", "1.429cm", "0.529cm", "07:35");
            LODOP.ADD_PRINT_TEXT("4.974cm", "9.525cm", "1.535cm", "0.529cm", "ZM010");
            LODOP.ADD_PRINT_TEXT("4.948cm", "11.165cm", "0.661cm", "0.529cm", "99");
            ////此处让程序停止1000ms再执行，否则会提示websocket还未准备好
            // sleep(1000);
            //LODOP.PREVIEW();
            LODOP.PRINT();
            // sleep(1000);
        };
    </script>
    进入<a href="javascript:;" onclick="javascript:CreatePrintPage();LODOP.PRINT_DESIGN();">模板设计</a><br>
    进入<a href="javascript:;" onclick="javascript:CreatePrintPage();LODOP.PREVIEW();">模板的打印预览</a><br>
    进入<a href="javascript:;" onclick="javascript:CreatePrintPage();LODOP.PRINT_SETUP();">模板的打印维护</a>
</body>
</html>